public class Teacher {
    // 定义教师属性
    private String name;
    private int yearsExperience;
    private String fieldOfStudy;
    private String university;
    private boolean isAdjunct;

    // 定义构造方法
    public Teacher(String name, int yearsExperience, String fieldOfStudy, String university, boolean isAdjunct) {
        this.name = name;
        this.yearsExperience = yearsExperience;
        this.fieldOfStudy = fieldOfStudy;
        this.university = university;
        this.isAdjunct = isAdjunct;
    }

    // 定义教师类方法
    public void teachSubject(String subject) {
        System.out.println(name + " is teaching " + subject + " at " + university);
    }

    public void displayYearsExperience() {
        System.out.println("Years of experience: " + yearsExperience);
    }
}



